package com.sunelec.mapper;


import com.sunelec.pojo.Collector;
import com.sunelec.pojo.Inverter;
import com.sunelec.pojo.Power;
import com.sunelec.pojo.stationRunTableExample3;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author: 吴遵明
 * @Description: 用于ReportCenter所有功能
 * @Date: Create in 2018/05/08
 * @Modified By:
 */

public interface ReportMapper {
    //电站运行情况表
    List<Power> selectPowerWithUser3(String level3user);

    List<Power> selectPowerWithUser2(String level2user);

    List<Power> selectPowerWithUser1();

    //根据power_id查询所有的collector
    List<Collector> selectCollectorWithPowerid(List li);

    String selectPowernameWithCollectorid(String collectorid);

    /*//根据date天数，leveluser来查询所有stationRunTablePOJO
    List<stationRunTablePOJO> selectStationRunByDate(@Param("date") String date, @Param("leveluser") String leveluser, @Param("type") int type);
    */

    //根据date天数，leveluser来查询所有inverter
    List<Inverter> selectInverterByDate(@Param("date") String date, @Param("power_id") String power_id);

    //根据power_name,type,leveluser查询power_id;
    Power selectPowerId(@Param("power_name") String power_name, @Param("leveluser") String leveluser, @Param("type") int type);

    //根据update_date,power_id查询，1.该update_date之前，2.每天最大电量，3.不同sn
    /*
        +--------------+-------------+------------------------+
        | collector_sn | update_date | max(daily_electricity) |
        +--------------+-------------+------------------------+
        | aa123        | 2018-05-01  |                    180 |
        | aa123        | 2018-05-07  |                   1001 |
        | aa555        | 2018-05-01  |                    150 |
        | aa555        | 2018-05-07  |                    150 |
        | aa666        | 2018-05-07  |                   1001 |
        +--------------+-------------+------------------------+
    */
    List<stationRunTableExample3> selectElecByPowerId(@Param("power_id") String power_id, @Param("update_date") String update_date);

    //根据update_dateMin, update_dateMax, power_id查询，1.update_dateMin, update_dateMax之间，2.每天最大电量，3.不同sn
    List<stationRunTableExample3> selectElecByPowerId2(@Param("power_id") String power_id, @Param("update_dateMin") String update_dateMin, @Param("update_dateMax") String update_dateMax);

    //根据collector_sn, date, time，查询该sn下的date之前总电量，精确到time
    Float selectElectricitySUMByDate(@Param("collector_sn") String collector_sn, @Param("date") String date);

    //根据collector_sn, date, time，查询该sn下的date当天总电量，精确到time
    Float selectElectricityDAYByDate(@Param("collector_sn") String collector_sn, @Param("date") String date, @Param("time") String time);
}
